package com.gc.rss;

import java.io.File;
import java.io.IOException;   

import org.jsoup.Jsoup;   
import org.jsoup.nodes.Document;   
import org.jsoup.nodes.Element;   
import org.jsoup.select.Elements;   
/**  
 *测试类  
 *用jasoup进行html具体的网页解析例子  
  @author ganliang13  
  {@link http://ganliang13.iteye.com/}  
 * */  
public class AA {   
    public static void main(String[] args) throws IOException{   
       long begin = System.currentTimeMillis();   
        //整个html内容   
        Document doc = Jsoup.connect("http://www.nenu.edu.cn/").timeout(50000).get(); // 设置连接超时时间    
           
        //打印html文档的<title>内容   
        System.out.println(doc.getElementsByTag("title"));   
           
        //打印html文档的<a>内容   
        Elements aels = doc.getElementsByTag("div");   
       // Elements aels1 = doc.getElementsByTag("a");   
           
        for (Element el : aels) {   
            System.out.println(el.toString());   
       }   
           
        //for (Element el : aels1) {   
           // System.out.println(el.toString());   
       // }   
        long end = System.currentTimeMillis();   
        System.out.println(end-begin);   
    	

    }   
 }
